package woaini.fenger.core.bot.json;

import com.alibaba.fastjson2.JSON;
import jakarta.annotation.PostConstruct;
import org.springframework.stereotype.Component;
import woaini.fenger.core.bot.event.Messages;
import woaini.fenger.core.bot.id.ID;

/**
 * 快速json配置 配置消息序列化
 * @see  woaini.fenger.core.bot.json.FastJsonConfig
 * @author yefeng
 * {@code @Date} 2023-05-16 16:50:39
 */
@Component
public class FastJsonConfig {

    @PostConstruct
    public  void init(){
        // 注册ID解析
        JSON.register(ID.class, new ID.Serializer<>());
        JSON.register(ID.class, new ID.Deserializer());

        JSON.register(Messages.class, new Messages.Deserializer());
        JSON.register(Messages.class, new Messages.Serializer());
    }
}
